﻿using Corina.Datamodel.Base;
using Corina.Datamodel.Interface;
using Corina.Enumerations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Corina.Datamodel.Entities
{
    [XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    public class ManagerInfo : DatamodelEntity, IManager
    {
        #region Fields
        private int _id;
        private string _account;
        private string _password;
        private string _name;
        private string _mobile;
        private string _email;
        private DateTime _registerTime = DateTime.Now;
        private int _roleId = 0;
        private bool _super = false;
        private AccountStatusValue _accountStatus = AccountStatusValue.Pending;
        #endregion

        #region Properties
        public override string TableName
        {
            get
            {
                return "t_manager";
            }
        }

        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged(() => Id);
            }
        }
        public string Account
        {
            get { return _account; }
            set
            {
                _account = value;
                RaisePropertyChanged(() => Account);
            }
        }
        public string Password
        {
            get { return _password; }
            set
            {
                _password = value;
                RaisePropertyChanged(() => Password);
            }
        }
        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                RaisePropertyChanged(() => Name);
            }
        }
        public string Mobile
        {
            get { return _mobile; }
            set
            {
                _mobile = value;
                RaisePropertyChanged(() => Mobile);
            }
        }
        public string Email
        {
            get { return _email; }
            set
            {
                _email = value;
                RaisePropertyChanged(() => Email);
            }
        }
        public DateTime RegisterTime
        {
            get { return _registerTime; }
            set
            {
                _registerTime = value;
                RaisePropertyChanged(() => RegisterTime);
            }
        }
        public int RoleId
        {
            get { return _roleId; }
            set
            {
                _roleId = value;
                RaisePropertyChanged(() => RoleId);
            }
        }
        public bool Super
        {
            get { return _super; }
            set
            {
                _super = value;
                RaisePropertyChanged(() => Super);
            }
        }
        public AccountStatusValue AccountStatus
        {
            get { return _accountStatus; }
            set
            {
                _accountStatus = value;
                RaisePropertyChanged(() => AccountStatus);
            }
        }
        #endregion

        protected override IEnumerable<DatabaseColumn> InitColumns()
        {
            yield return new DatabaseColumn("Id", true);
            yield return new DatabaseColumn("Account", false, true);
            yield return new DatabaseColumn("Password", false, true);
            yield return new DatabaseColumn("Name");
            yield return new DatabaseColumn("Mobile");
            yield return new DatabaseColumn("Email");
            yield return new DatabaseColumn("RegisterTime", false, true);
            yield return new DatabaseColumn("RoleId", false, true);
            yield return new DatabaseColumn("Super", false, true);
            yield return new DatabaseColumn("AccountStatus", false, true);
        }
    }
}